<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>局部指令</title>
</head>
<script src="vue.js"></script>
<body>
    <div id="app">
        <p v-color="mycolor">私有指令</p>
    </div>
    <script>
        var vm = new Vue({
            el:'#app',
            data:{
                mycolor:'red'
            },
            directives:{
            'color':function(el,binding){
                el.style.color = binding.value;
            }
            }
        })
    </script>
</body>
</html>